package solved;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

/*
 ID:	liluyan1
 LANG:	JAVA
 TASK:	calfflac
 */
public class calfflac {
	public static void main(String[] args) throws IOException {
		BufferedReader f = new BufferedReader(new FileReader("calfflac.in"));
		StringBuilder in = new StringBuilder();
		String line;
		while ((line = f.readLine()) != null) {
			in.append(line);
			in.append("\n");
		}
		String str = in.toString();
		Solution res = new calfflac().solve(str);
		
		PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(
				"calfflac.out")));
		out.println(res.count);
		out.println(str.substring(res.begin, res.end));
		out.close();
		System.exit(0);
	}
	
	private Solution solve(String in) {
		int max = 0, begin = 0, end = 0;
		int N = in.length();
		for (int center=0; center<N; center++) {
			if (!isAlphabet(in.charAt(center))) continue;
			int len = 1, before = center-1, after = center+1;
			int b = 0, e = 0;
			while(true) {
				before = before(in, before);
				after = after(in, after);
				if (!equals(in, before, after)) break;
				len += 2;
				b = before;
				e = after + 1;
				before--;
				after++;
			}
			if (len > max) {
				max = len;
				begin = b;
				end = e;
			}
			
			len = 0;
			before = center;
			after = center + 1;
			while(true) {
				before = before(in, before);
				after = after(in, after);
				if (!equals(in, before, after)) break;
				len += 2;
				b = before;
				e = after + 1;
				before--;
				after++;
			}
			if (len > max) {
				max = len;
				begin = b;
				end = e;
			}
		}
		
		return new Solution(max, begin, end);
	}
	
	private boolean equals(String in, int i, int j) {
		return (i>=0 && j<in.length() && 
				Character.toUpperCase(in.charAt(i)) == Character.toUpperCase(in.charAt(j)));
	}
	
	private int before(String in, int pos) {
		int i = pos;
		while (i>=0 && !isAlphabet(in.charAt(i))) i--;
		return i;
	}
	
	private int after(String in, int pos) {
		int i = pos;
		while (i<in.length() && !isAlphabet(in.charAt(i))) i++;
		return i;
	}
	
	private boolean isAlphabet(char c) {
		return (c>='A' && c<='Z') || (c>='a' && c<='z');
	}
	
	private class Solution {
		int count;
		int begin;
		int end;
		public Solution(int count, int begin, int end) {
			this.count = count;
			this.begin = begin;
			this.end = end;
		}
	}
}
